export default {
  table: 'ie_user',
  columns: [
    {
      key: 'id'
    },
    {
      title: '用户账号',
      key: 'username',
      sorter: true
    },
    {
      title: '手机号码',
      key: 'phone',
      nullValue: '无'
    },
    {
      title: '电子邮箱',
      key: 'email',
      nullValue: '无'
    },
    {
      title: '头像',
      key: 'avatar',
      type: 'file',
      nullValue: '无'
    },
    {
      title: '用户类型',
      key: 'user_type',
      options: [
        { label: '网页', value: 0, type: 'info' },
        { label: '微信', value: 1, type: 'info' }
      ],
      nullValue: '未指定'
    },
    {
      title: '状态',
      key: 'active',
      options: [
        { label: '通过', value: true, type: 'success' },
        { label: '禁止', value: false, type: 'error' }
      ],
    },
    {
      title: '更新时间',
      key: 'update_at',
      type: 'date',
      sorter: true
    },
    {
      title: '创建时间',
      key: 'create_at',
      type: 'date',
      sorter: true
    },
    {
      key: 'deleted_at'
    }
  ],
  queryOptions: {
    user_type: {
      type: 'select'
    },
    active: {
      type: 'select'
    }
  },
  formInputs: {
    username: {
      rules: [
        { required: true, message: '用户账号不可为空' },
        { min: 6, max: 20, message: '用户账号长度为6-20' },
        { pattern: /^[0-9a-zA-Z_-]+$/, message: '用户账号只能使用数字、英文大小写、下划线、中横线' }
      ]
    },
    password: {
      title: '用户密码',
      type: 'password',
      rules: [
        { required: true, message: '登录密码不可为空' },
        { min: 6, max: 20, message: '登录密码长度为6-20' }
      ]
    },
    phone: {
      rules: [
        { pattern: /^[0-9]+$/, message: '电话格式不正确' }
      ]
    },
    avatar: {
      type: 'upload'
    },
    user_type: {
      type: 'select'
    }
  }
}
